Ext.define('HRMobile.store.SurveyStore', {
    extend: 'Ext.data.Store',
     
    config: {
     model: 'HRMobile.model.Survey',
     headers: {'Content-Type':'text/html; charset=UTF-8'},
     proxy: {
         type: 'ajax',
         url: 'SurveyServlet',
         reader: {
             type: 'json',
             totalProperty: 'totalCount',
             rootProperty: 'surveys',
             successProperty: 'success',
             extraParams:[{name: 'userSubUnitId'},
                          {name : 'userId'}] ,
         	}
     	},
     	listeners : {
            load : function(store) {
            	Ext.getCmp('main').getTabBar().items.getAt(3).setBadgeText(store.getCount());
            	Ext.getCmp('lblSurveyCount').setHtml('&bull; You have <b>' +store.getCount()+'</b> unanswered survey(s).');
            }
        } 
     
    }
});